import { axiosInstance } from '../utils/request'

//获取菜单
export const getMenuApi = (data) => {
    return axiosInstance.get(`/menu?${data}`, { headers: { 'Authentication': localStorage.token } })
}

//根据用户名获取菜单
export const getMenuByNameApi = (username) => {
    return axiosInstance.get(`/menu/${username}`, { headers: { 'Authentication': localStorage.token } })
}

//新增菜单
export const addMenu = (data) => {
    return axiosInstance.post('/menu', data, { headers: { 'Authentication': localStorage.token } })
}

//根据 ID 删除菜单
export const delMenu = (id) => {
    return axiosInstance.delete(`/menu/${id}`, { headers: { 'Authentication': localStorage.token } })
}

//修改菜单
export const changeMenu = (data) => {
    return axiosInstance.put('/menu', data, { headers: { 'Authentication': localStorage.token } })
}